<?php

	class viewport_profiler extends viewport {
		public function exec(){
			
			$peak_usage = UTILS_size_convert(memory_get_peak_usage());
			
			$avg_usage = $this->get_avg_memory_usage();
			
			$this->assign("peak_usage",$peak_usage);
			$this->assign("avg_usage" ,$avg_usage);
			
			//todo: add db profiling
			
			$db_profile = context::get("db")->profile();
			
			print_r($db_profile);
			
			$this->assign("db_profile",$db_profile);
			
		}		
		
		
		private function get_avg_memory_usage(){
			//todo: add actual profiling there?
			
			//return context::profiler()->get_avg_memory_usage();
		}
	}

?>
